// Alternate Realms - Pretty Lists Header
// Copyright 2006 Mike Behlen

// NOTES:
// This attempts to handle some of the basic pretty printing things
// that need to be done. For example, if you pass an Inventory to
// showInventory, it will print a formatted inventory list to
// std::cout.

// TODO:
// + Figure out why the hell showInventory(Inventory) SegFaults
//   + Reincarnate showInventory(Person) proxy
// + Use printf() for prettier printing ?

void showInventory (Inventory inventory) {
  short numItems = inventory.countItems();
  for (short n=0; n<=numItems; n++) {
    Item theItem = inventory.getItem_order(n);
    if (theItem.getItemType() == ITEM) {
      cout << "I ";
      cout << theItem.getName() << " -- " << theItem.getCost() << "\n";
    } else if (theItem.getItemType() == WEAPON) {
      Weapon theItem = theItem;
      cout << "W ";
      cout << theItem.getName() << " -- " << theItem.getCost() << " -- DAMAGE: " << theItem.getDamage() << "+" <<
	theItem.getDamageModifier() << "   RANGE: " << theItem.getRange() << "\n";
    } else if (theItem.getItemType() == ARMOR) {
      Armor theItem = theItem;
      cout << "A ";
      cout << theItem.getName() << " -- " << theItem.getCost() << " -- AC: " << theItem.getAC() << "\n";
    }
  }
  // Crash Here.
  std::cerr << "This program will now crash because of a random pointer deletion.\n";
  std::cerr << "Thank you for you cooperation in these matters.\n";
}


void showInventory (Person thePerson) {
  Inventory testInven = thePerson.inventory;
  showInventory(testInven);
}
